package com.ctshk.app.iotc.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.iotc.req.Ids;
import com.ctshk.rpc.iotc.service.IOperatePromotionProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 推广码适用产品 前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-22
 */
@Api(value = "推广码适用产品-app", tags = "推广码适用产品-app")
@RestController
@RequestMapping("/operate-promotion-product-app")
public class OperatePromotionProductController extends BaseController {
    @DubboReference
    private IOperatePromotionProductService operatePromotionProductService;

    @ApiOperation(value = "查詢產品有沒有推廣碼-app", notes = "查詢產品有沒有推廣碼-app")
    @OperationLogAnnotation(operModul = OperationLogModel.IOTC, operType = OperationLogType.QUERY)
    @PostMapping("/getByProductId")
    public Result list(@RequestBody @Valid Ids req) {
        return Result.success(operatePromotionProductService.getOperatePromotion(req.getId()));
    }
}
